/*
 * Rectangle.hpp
 *
 *  Created on: 23-11-2010
 *      Author: Przemek
 */

#pragma once

#include "geometry/Vector.hpp"
#include "geometry/Dimension.hpp"
#include "geometry/Line.hpp"

// namespace used for conflicts with windows.h Rectangle stuff :/
namespace geometry
{

class Rectangle
{
	private:
		Vector position;
		Dimension size;

	public:
		explicit Rectangle(const Vector& position = Vector(), const Dimension& size = Dimension());
		Rectangle(const Rectangle& other);

		const Vector& getPosition() const;
		void setPosition(const Vector& position);
		const Dimension& getSize() const;
		void setSize(const Dimension& size);

		Rectangle translate(const Vector& vector) const;
		bool contains(const Vector& point) const;
		bool isEmpty() const;
		Vector getCenter() const;
		Vector getLeftCornerForCenteredDimension(const Dimension& dimension) const;

		bool intersects(const Rectangle& other) const;
		bool intersects(const Line& line) const;

		Rectangle getIntersection(const Rectangle& other) const;

		Rectangle& operator+=(const Vector& vector);
		Rectangle& operator-=(const Vector& vector);

		Rectangle& operator=(const Rectangle& other);
		bool operator==(const Rectangle& other) const;
		bool operator!=(const Rectangle& other) const;
};

}
